package com.nj.forward.user.login.service;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Service;

import com.nj.forward.user.login.dao.UserLoginDAO;
import com.nj.framework.util.MD5;

@Service
public class UserLoginService {
	@Autowired
	private UserLoginDAO userLoginDAO;
	//简单登陆
	public Map<String,String> commonLogin(String userCode,String passWord,String remindMe) throws DataAccessException, ClassNotFoundException{
		Map<String,String> returnMap=new HashMap<String, String>();
		int count=userLoginDAO.queryUser(userCode, MD5.encode(passWord));
		if(count>0){
			//用户名和密码正确
			returnMap.put("flag", "Y");
		}else{
			returnMap.put("flag", "N");
			returnMap.put("errorMsg", "用户名或者密码不正确");
		}
		return returnMap;
	}
}
